/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pig.mt.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;

/**
 * 公众号账号
 *
 * @author JLM
 * @date 2021-03-05 11:45:09
 */
@Data
@TableName("wx_account")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "公众号账号")
public class WxAccount extends Model<WxAccount> {
private static final long serialVersionUID = 1L;

    /**
     * appid
     */
    @TableId(type = IdType.ASSIGN_UUID)
    @ApiModelProperty(value="appid")
    private String appid;
    /**
     * 公众号名称
     */
    @ApiModelProperty(value="公众号名称")
    private String name;
    /**
     * 账号类型
     */
    @ApiModelProperty(value="账号类型")
    private Integer type;
    /**
     * 认证状态
     */
    @ApiModelProperty(value="认证状态")
    private Integer verified;
    /**
     * appsecret
     */
    @ApiModelProperty(value="appsecret")
    private String secret;
    /**
     * token
     */
    @ApiModelProperty(value="token")
    private String token;
    /**
     * aesKey
     */
    @ApiModelProperty(value="aesKey")
    private String aesKey;

	public WxMpDefaultConfigImpl toWxMpConfigStorage(){
		WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl();
		configStorage.setAppId(appid);
		configStorage.setSecret(secret);
		configStorage.setToken(token);
		configStorage.setAesKey(aesKey);
		return configStorage;
	}
}
